package com.game.dubbo.hall;

import com.game.message.Msg;
import com.game.message.jpb.JPbUtil;
import com.game.message.messagecode.DubboMsg;
import com.game.message.messagecode.MsgStage;
import com.game.message.task.AbstractDubboProcessor;
import com.game.messagebean.dubbo.RechargeReq;
import com.game.mongo.UserMongo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * Created by Administrator on 2016/6/13.
 */
@Component
public class RechargeProcessor extends AbstractDubboProcessor {
	private Logger logger = LoggerFactory.getLogger(this.getClass());
	@Autowired
	private UserMongo userMongo;

	public int getMsgId() {
		return MsgStage.REQ + DubboMsg.Recharge;
	}

	public Msg process(Msg msg, int userId) {
		RechargeReq buyYuanBaoRequest = JPbUtil.getPb(RechargeReq.class,msg);
		int yuanbao = buyYuanBaoRequest.getYuanbao();
		userMongo.incField(userId, "yuanbao", yuanbao);
		logger.info("RechargeProcess....");
		return null;
	}
}
